home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Presentations
/
Presentations ’88
/
Fritz Proceedings stuff
/
setLDEF.c
< prev
Wrap
C/C++ Source or Header
|
1988-04-02
|
2KB
|
73 lines
#include <QuickDraw.h>
#include <Lists.h>
#include <Fonts.h>
#define HiliteMode (*(unsigned char *)0x938)
#define hiliteBit 7 /* flag bit in HiliteMode (lowMem flag) */
typedef struct {
short baseLine;
RgnHandle cellRgn;
} LRefCon, *LRCPtr, **LRCHandle;
#define LBaseLine(list) ((*(LRCHandle)(*list)->refCon)->baseLine)
#define LCellRgn(list) ((*(LRCHandle)(*list)->refCon)->cellRgn)
pascal void main(lMessage, lSelect, lRect, lCell,
lDataOffset, lDataLen, lHandle)
short lMessage;
Boolean lSelect;
Rect *lRect;
Cell lCell;
short lDataOffset,
lDataLen;
ListHandle lHandle;
{
void Initialize(),
Draw();
RgnHandle drawRgn,
temp;
switch (lMessage) {
case lInitMsg: Initialize(lHandle);
break;
case lDrawMsg: if (lDataLen > 0) {
Draw(lDataOffset, LBaseLine(lHandle),
(*lHandle)->cells, lRect,
(*lHandle)->cellSize);
drawRgn = LCellRgn(lHandle);
RectRgn(temp = NewRgn(), lRect);
UnionRgn(temp, drawRgn, drawRgn);
DisposeRgn(temp);
if (!lSelect)
break;
}
else
break;
/**********************
* NOTE TRICK HERE
* Will fall thru if
* the cell is to be
* drawn "selected."
**********************/
case lHiliteMsg: HiliteMode &= 0x7F; /* Don't we have to sense CQD? */
InvertRect(lRect);
break;
default: break;
}
}
void Initialize(lHandle)
ListHandle lHandle;
{
FontInfo theFont;
LRefCon theRef;
GetFontInfo(&theFont);
theRef.baseLine = theFont.ascent + theFont.leading;
theRef.cellRgn = NewRgn();
HLock(lHandle);
PtrToHand(&theRef, &(*lHandle)->refCon, sizeof(LRefCon));
HUnlock(lHandle);
}